package com.cjj2016.cjj.mylyricviewdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

import com.cjj2016.cjj.mylyricviewdemo.widget.MyFloatView;

public class MiniActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = "MiniActivity";

    private View floatView;

    private View menuView;

    private MyFloatView myFloatView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mini);
        Button btnOpenFloat = (Button) findViewById(R.id.btn_openFloat);
        btnOpenFloat.setOnClickListener(this);

        floatView = LayoutInflater.from(this).inflate(R.layout.layout_float,null);
        menuView = LayoutInflater.from(this).inflate(R.layout.layout_menu,null);
        ImageButton btnPre = (ImageButton) menuView.findViewById(R.id.player_previous);
        btnPre.setOnClickListener(this);
        ImageButton btnPlay = (ImageButton) menuView.findViewById(R.id.player_play);
        btnPlay.setOnClickListener(this);
        ImageButton btnNext = (ImageButton) menuView.findViewById(R.id.player_next);
        btnNext.setOnClickListener(this);

        myFloatView = new MyFloatView(this,floatView,menuView);

    }



    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_openFloat:
                if( !myFloatView.getShowing() ){
                    myFloatView.show();
                }else {
                    myFloatView.hide();
                }

                break;
            case R.id.player_previous:
                Toast.makeText(this, "previous", Toast.LENGTH_SHORT).show();
                break;
            case R.id.player_play:
                Toast.makeText(this, "play", Toast.LENGTH_SHORT).show();
                break;
            case R.id.player_next:
                Toast.makeText(this, "next", Toast.LENGTH_SHORT).show();
                break;
        }
    }
//




}
